import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * User: wenxiwen
 * Date: 2022/4/9
 * Time: 15:23
 * Description: No Description
 */
class Student/* implements Comparable <Student> */{
    public String name;
    public int age;
    public double score;

    public Student(String name, int age, double score) {
        this.age = age;
        this.name = name;
        this.score = score;

    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", score=" + score +
                '}';
    }

    //整形比较
  /*  public int compareTo(Student o) {
        if(this.age - o.age > 0) {
            return 1;
        } else if (this.age == o.age) {
            return 0;
        } else {
            return -1;
        }
    }

    //整形排序简写形式
    public int compareTo(Student o) {
        return this.age - o.age;
    }*/
    //姓名排序
  /*  public int compareTo(Student o) {
        if(this.name.compareTo(o.name) > 0) {
            return 1;
        } else if(this.name.compareTo(o.name) == 0) {
            return 0;
        } else {
            return -1;
        }
    }*/

    //字符排序简写形式
   /* public int compareTo(Student o) {
        return this.name.compareTo(o.name);
    }*/

    //小数排序
   /* public int compareTo(Student o) {
        if(o.score - this.score > 0) {
            return 1;
        } else if(this.score - o.score == 0) {
            return 0;
        } else {
            return -1;
        }
    }*/

    //小数排序简写形式
    /*public int compareTo(Student o) {
        return (int)(this.score - o.score);
    }*/
}



public class TestDemo {
    public static void main(String[] args) {
        Student[] student = new Student[3];
        student[0] = new Student("zhangsan",29,88);
        student[1] = new Student("lisi",20,66);
        student[2] = new Student("wangwu",25,13);

        Arrays.sort(student);
        System.out.println(Arrays.toString(student));
    }
    public static void main4(String[] args) {

    }
   /* public static void main3(String[] args) {
        Student student = new Student("zhangsan",29,88);
        Student student1 = new Student("lisi",20,66);
        Student student2 = new Student("wangwu",25,13);

        int ret = student.compareTo(student1);
        if(ret > 0) {
            Student s1 = student;
            student = student1;
            student1 = s1;
        }

        // Arrays.sort(student,student1);
        System.out.println(student1);
    }*/

    public static void main3(String[] args) {
        Student[] student = new Student[3];
        student[0] = new Student("zhangsan",29,88);
        student[1] = new Student("lisi",20,66);
        student[2] = new Student("wangwu",25,13);

        Arrays.sort(student);
        System.out.println(Arrays.toString(student));
    }
    public static void main1(String[] args) {
        int[] array = {5,6,8,1,2,3,4,10,9,};
        Arrays.sort(array);


        System.out.println(Arrays.toString(array));
    }
}